﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Boxi.UserControls
{
    public partial class Alert : UserControl
    {
        /// <summary>
        /// 
        /// </summary>
        public String ShowDetailsButtonText
        {
            get
            {
                return _showDetailsButtonText;
            }
            set
            {
                _showDetailsButtonText = value;
            }
        }
        private String _showDetailsButtonText;

        /// <summary>
        /// 
        /// </summary>
        public String HideDetailsButtonText
        {
            get
            {
                return _hideDetailsButtonText;
            }
            set
            {
                _hideDetailsButtonText = value;
            }
        }
        private String _hideDetailsButtonText;

        /// <summary>
        /// 
        /// </summary>
        public String CloseButtonText
        {
            get
            {
                return _closeButtonText;
            }
            set
            {
                _closeButtonText = value;
            }
        }
        private String _closeButtonText;

        public Alert()
        {
            InitializeComponent();

            if (ShowDetailsButtonText == null)
                ShowDetailsButtonText = btnAlertDetails.Content.ToString();

            if (HideDetailsButtonText == null)
                HideDetailsButtonText = "Hide Details";

            if (CloseButtonText == null)
                CloseButtonText = btnAlertClose.Content.ToString();
           
        }

        private void btnAlertDetails_Click(object sender, RoutedEventArgs e)
        {
            if (txtAlertDetails.Visibility == System.Windows.Visibility.Collapsed)
            {
                txtAlertDetails.Visibility = System.Windows.Visibility.Visible;
                txtAlertDetails.Text = HideDetailsButtonText;
            }
            else
            {
                txtAlertDetails.Visibility = System.Windows.Visibility.Collapsed;
                txtAlertDetails.Text = ShowDetailsButtonText;
            }
        }

        private void btnAlertClose_Click(object sender, RoutedEventArgs e)
        {
            HideAlert();
        }

        public void ShowAlert(String message, String details)
        {
            txtAlertMessage.Text = message;
            txtAlertDetails.Text = details;

            txtAlertDetails.Text = ShowDetailsButtonText;
            txtAlertDetails.Visibility = System.Windows.Visibility.Collapsed;
            rclOverlay.Visibility = System.Windows.Visibility.Visible;
        }

        public void HideAlert()
        {
            txtAlertMessage.Text = String.Empty;
            txtAlertDetails.Text = String.Empty;
            rclOverlay.Visibility = System.Windows.Visibility.Collapsed;
        }
    }
}
